<?php
require("../db_conn.php");
$recc=isset($_GET['recc'])?$_GET['recc']:"";
if($recc>0)
 {
$sql="SELECT * FROM `td_manager`  where id=$recc";   //写查询语句  isshow=1   取5个    
$adrs=$db->query($sql); //执行语句  $rs是一个结果集
$arow=$adrs->fetch_array(MYSQLI_BOTH);   //包括所有行 
}
$rec=isset($_GET['rec'])?$_GET['rec']:"";
if($rec>0)
    {
       $username=$_POST['username'];
       $e_mail=$_POST['e_mail'];
       $password=$_POST['password'];
       $password_confirm=isset($_POST["password_confirm"]);
       if($password==$password_confirm)
       {
           $sql="update td_manager set username='$username', password='$password',e_mail='$e_mail' where id=$rec";
           $rs=$db->query($sql);


            if ($rs==FALSE)
                {
                    echo "<script language='javascript' type='text/javascript'>";
                    echo "alert('修改失败！');";
                    echo "window.location.href='manager.php'";
                    echo "</script>";
                }
             else 
                {
                  echo "<script language='javascript' type='text/javascript'>";
                    echo "alert('修改成功！');";
                    echo "window.location.href='manager.php'";
                    echo "</script>";  
                }
        }
     else 
        {
            echo "<script language='javascript' type='text/javascript'>";
            echo "alert('修改失败！');";
            echo "window.location.href='manager.php'";
            echo "</script>";
        }
}



//释放结果集
if($recc>0)
{
require ('addmanager_html1.php');
}
 else {
    require ('manager.php');
}
